import React from 'react';
import GroupHeader from '@/components/GroupHeader';

const Layout: React.FC<{ children: any; history: any }> = (props) => {
  var options = [
    {title: '考试管理', path: '/teaching/exam/test'},
    {title: '试卷管理', path: '/teaching/exam/paper'},
    {title: '题库管理', path: '/teaching/exam/question'},
    // {title: '实训考核', path: '/teaching/exam/training'},
    {title: '考核点', hide: true, path: '/teaching/exam/checkPointer'},
    {title: '试卷标签', path: '/teaching/exam/tags'},
    {title: '试卷分类', path: '/teaching/exam/type'},
    {title: '试卷分类', hide: true, path: '/teaching/exam/paperDetailes'},
    {title: '新增试题', hide: true, path: '/teaching/exam/newQuestion'},
    {title: '查看试题', hide: true, path: '/teaching/exam/viewQuestion'},
    {title: '试卷编辑', hide: true, path: '/teaching/exam/editor'},
  ];
  var op = options.find((item) => item.path === props.history.location.pathname);
  if (!op) props.history.push(options[0].path);

  return (
    <>
      <GroupHeader
        onChage={(value) => {
          props.history.push(value.path);
        }}
        {...props}
        defaultValue={op ? op.title : options[0].title}
        prefix="课程管理"
        options={options}
      ></GroupHeader>
      {props.children}
    </>
  );
};

export default Layout;
